import axios from 'axios'
var baseURL = 'https://douban.uieee.com'
var instance = axios.create({
  timeout: 1000 * 12,
  // withCredentials: true,
  baseURL: baseURL
})

export function GETAPI (url, params) {
  return new Promise((resolve, reject) => {
    instance({
      url: baseURL + url,
      params: params,
      method: 'GET'
    }).then(res => {
      resolve(res)
    }).catch(err => {
      reject(err)
    })
  })
}
export function POSTAPI (url, data) {
  return new Promise((resolve, reject) => {
    instance({
      url: baseURL + url,
      data: data,
      method: 'POST'
    }).then(res => {
      resolve(res)
    }).catch(err => {
      reject(err)
    })
  })
}
